﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Xml;

namespace Albatross.Common.WCF
{
	public class DotNetDataContractOperationBehavior : DataContractSerializerOperationBehavior
	{
		public DotNetDataContractOperationBehavior( OperationDescription operation )
			: base( operation )
		{
		}

		public DotNetDataContractOperationBehavior( OperationDescription operation, DataContractFormatAttribute dataContractFormatAttribute )
			: base( operation, dataContractFormatAttribute )
		{
		}

		public override XmlObjectSerializer CreateSerializer( Type type, string name, string ns,
															 IList<Type> knownTypes )
		{
			return new NetDataContractSerializer( name, ns );
		}

		public override XmlObjectSerializer CreateSerializer( Type type, XmlDictionaryString name,
															 XmlDictionaryString ns, IList<Type> knownTypes )
		{
			return new NetDataContractSerializer( name, ns );
		}
	}
}